package com.alstudio.ui.base;

import java.io.File;
import java.io.IOException;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.FragmentActivity;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;

import com.alstudio.R;
import com.alstudio.app.LocalEnv;
import com.alstudio.net.protocol.xmpp.data.XmppConnectionState;
import com.alstudio.utils.ALActivityManager;
import com.alstudio.utils.ALActivityManager.ActivityLifeCycleState;
import com.alstudio.utils.android.ALFileManager;
import com.alstudio.utils.android.AndroidMultiMediaManager;
import com.alstudio.utils.android.imageProcess.ALImageProcessParams;
import com.alstudio.utils.android.net.ALConnectionManager;
import com.alstudio.utils.android.net.ALConnectionManager.ALConnectionType;
import com.alstudio.utils.android.net.ALNetworkChangedListener;
import com.alstudio.utils.log.Mylog;
import com.alstudio.utils.notification.NoticeItem;
import com.alstudio.utils.notification.NoticeItemEventListener;
import com.alstudio.view.dialog.AlertDialogCreator;
import com.alstudio.view.listener.AnimationEndListener;
import com.alstudio.view.listener.ViewEventListener;
import com.alstudio.view.toast.MyToast;
import com.alstudio.view.toast.MyToastUtil;

/**
 * 所有UI的基类
 * 
 * @author Alonso Lee
 * 
 */
public abstract class BaseActivity extends Activity implements
		NoticeItemEventListener, ALNetworkChangedListener {

	/* 界面名称 */
	public String activityName;
	/* 此变量用于描述是否需要接收XmppEventNotifier的回调通知 */
	private boolean callbackEnable = false;

	private ActivityLifeCycleState mActivityState;
	public Handler mhandler;
	// 通知区域事件监听器
	private NoticeAreaEventListener mNoticeAreaListener;
	// 此变量用于标识当前是否正在显示通知区域
	private boolean isNoticeAreaShowing = false;
	// 此变量用于标识是否需要定时自动关闭通知区域
	private boolean isAutoDismissNoticeAreaEnable = true;
	// 通知区域缺省显示时常
	private long NOTICE_AREA_SHOW_DURATION = 5 * 1000;
	// 通知区域显示时常
	private long mNoticeAreaShowDuration = NOTICE_AREA_SHOW_DURATION;
	// 自定义通知区域显示动画资源
	private int mNoticeAreaShowAnimationRes = -1;
	// 自定义通知区域隐藏动画资源
	private int mNoticeAreaDismissAnimationRes = -1;
	// 关闭通知区域
	private final int DISMISS_NOTICE_AREA = 10010;
	// 此变量标识界面当前是否可见
	private boolean isActivityOn = false;

	/****************************** 以下为view定义 **************************************/
	/* 对话框 */
	public AlertDialogCreator mDialog;
	// 内容布局
	private LinearLayout contentLayout;
	// 通知区域
	private LinearLayout noticeLayout;
	// 通知区域的显示、隐藏动画
	private Animation noticeAnimation;

	/******************************** 以下为拍照、选择照片、截取照片定义 **********************************************/
	private ALImageProcessParams mPhotoProcessParam;

	private void notifyActivityLifeCycleStateChanged(
			ActivityLifeCycleState state, BaseActivity a) {
		Mylog.d("activity life cycle changed!last state is " + mActivityState
				+ " current state is " + state);
		mActivityState = state;
		ALActivityManager.getALActivityManager().notifyLifeCycleStateChanged(
				state, a);
	}

	public ActivityLifeCycleState getActivityState() {
		return mActivityState;
	}

	public boolean isActivityOn() {
		return this.isActivityOn;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		// 设定基本布局
		setContentView(R.layout.base_layout);
		// 初始化变量
		initEnv();
		// // 初始化页面数据
		// initData();
		notifyActivityLifeCycleStateChanged(ActivityLifeCycleState.CREATE, this);
		ALConnectionManager.AddNetworkChangedListener(this);
	}

	@Override
	public void finish() {
		// TODO Auto-generated method stub
		super.finish();
		LocalEnv.mXmppEventNotifyManager.unRegisterListener(this);
		overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit);
		notifyActivityLifeCycleStateChanged(ActivityLifeCycleState.FINISH, this);
		ALConnectionManager.removeNetworkChangedListener(this);
	}

	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
		notifyActivityLifeCycleStateChanged(ActivityLifeCycleState.DESTROY,
				this);
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		isActivityOn = true;
		notifyActivityLifeCycleStateChanged(ActivityLifeCycleState.RESUME, this);
	}

	@Override
	protected void onPause() {
		// TODO Auto-generated method stub
		super.onPause();
		isActivityOn = false;
		notifyActivityLifeCycleStateChanged(ActivityLifeCycleState.PAUSE, this);
	}

	@Override
	protected void onStop() {
		// TODO Auto-generated method stub
		super.onStop();
		notifyActivityLifeCycleStateChanged(ActivityLifeCycleState.STOP, this);
	}

	@Override
	protected void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
		notifyActivityLifeCycleStateChanged(ActivityLifeCycleState.START, this);
	}

	@Override
	public void onBackPressed() {

		// 正在显示通知区域，关掉它
		if (isNoticeAreaShowing) {
			dismissNotice();
			return;
		}
		finishMyActivity();
	}

	/**
	 * 初始化变量
	 * 
	 * @author Alonso Lee
	 */
	private void initEnv() {
		// 获取界面内容区
		contentLayout = (LinearLayout) findViewById(R.id.content_layout);
		// 获取通知区域
		noticeLayout = (LinearLayout) findViewById(R.id.notice_area);
		mhandler = new Handler();
		// instance = this;

		MyToastUtil.setToastEventListener(this);
	}

	/**
	 * 此方法用于初始化UI
	 * 
	 * @author Alonso Lee
	 */
	protected void setupView(Context context, String name) {
		activityName = name;
		LocalEnv.mXmppEventNotifyManager.registerListener(this);
	}

	/**
	 * 设置内容区的布局文件
	 */
	public void setContentRes(int layoutResId) {
		LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View v = inflater.inflate(layoutResId, null);
		if (v != null) {
			v.setLayoutParams(new LinearLayout.LayoutParams(
					LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
			contentLayout.addView(v);
		}
	}

	/**
	 * 此方法用于设定各个view的点击事件监听器
	 * 
	 * @author Alonso Lee
	 */
	protected void setViewClickListener() {

	}

	/**
	 * 初始化页面数据
	 * 
	 * @author Alonso Lee
	 */
	abstract protected void initData();

	protected void finishMyActivity() {
		finish();
		overridePendingTransition(R.anim.activity_left_to_right,
				R.anim.fade_out);
	}

	protected void startMyActivity(Intent intent, int enterAnim, int exitAnim) {
		startActivity(intent);
		overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit);
	}

	protected void startMyActivityForResult(Intent intent, int requestCode,
			int enterAnim, int exitAnim) {
		startActivityForResult(intent, requestCode);
		overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit);
	}

	/**
	 * 设定页面进入全屏模式
	 * 
	 * @author Alonso Lee
	 */
	protected void enterFullScreenMode() {

		WindowManager.LayoutParams params = getWindow().getAttributes();
		params.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
		getWindow().setAttributes(params);
		getWindow()
				.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
	}

	/**
	 * 设定页面退出全屏模式
	 * 
	 * @author Alonso Lee
	 */
	protected void exitFullScreenMode() {
		WindowManager.LayoutParams params = getWindow().getAttributes();
		params.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
		getWindow().setAttributes(params);
		getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
	}

	/**
	 * 设定通知区域view事件监听器
	 * 
	 * @param listener
	 * @author Alonso Lee
	 */
	protected void setNoticeAreaListener(NoticeAreaEventListener listener) {
		if (listener != null) {
			mNoticeAreaListener = listener;
		}
	}

	/**
	 * 移除通知区域view事件监听器
	 * 
	 * @author Alonso Lee
	 */
	protected void removeNoticeAreaListener() {
		mNoticeAreaListener = null;
	}

	/**
	 * 将制定的view添加到通知区域中。
	 * 
	 * @param child
	 * @author Alonso Lee
	 */
	protected void setNoticeLayout(View child) {

		if ((noticeLayout != null) && (child != null)) {
			noticeLayout.removeAllViews();
			noticeLayout.addView(child);
		}
	}

	/**
	 * 设定通知区域显示时常。传入的值为毫秒。
	 * 
	 * @param time
	 * @author Alonso Lee
	 */
	protected void setNoticeAreaShowDuration(long time) {
		if (time > 0) {
			mNoticeAreaShowDuration = time;
		}
	}

	/**
	 * 设定通知区域显示时的过场动画
	 * 
	 * @param res
	 *            -1则表示恢复缺省动画
	 * @author Alonso Lee
	 */
	protected void setNoticeAreaShowAnimationRes(int res) {
		mNoticeAreaShowAnimationRes = res;
	}

	/**
	 * 设定通知区域隐藏时的过场动画
	 * 
	 * @param res
	 *            -1则表示恢复缺省动画
	 * @author Alonso Lee
	 */
	protected void setNoticeAreaDismissAnimationRes(int res) {
		mNoticeAreaDismissAnimationRes = res;
	}

	/**
	 * 设定通知区域是否定时自动消失
	 * 
	 * @param enable
	 *            true表示需要自动消失 false 表示不需要自动消失
	 * @author Alonso Lee
	 */
	protected void setNoticeAreaAutoDismiss(boolean dismiss) {
		isAutoDismissNoticeAreaEnable = dismiss;
	}

	/**
	 * 检查通知区域当前是否设为定时自动消失
	 * 
	 * @return true 表示当前设定为自动消失
	 * @author Alonso Lee
	 */
	protected boolean isNoticeAreaAutoDismiss() {
		return isAutoDismissNoticeAreaEnable;
	}

	/**
	 * 显示通知区域
	 * 
	 * @author Alonso Lee
	 */
	protected void showBaseNotice() {
		if (noticeLayout != null) {
			noticeLayout.setVisibility(View.VISIBLE);
			isNoticeAreaShowing = true;
			if (mNoticeAreaShowAnimationRes != -1) {
				// 设定自定义显示动画
				noticeAnimation = AnimationUtils.loadAnimation(this,
						mNoticeAreaShowAnimationRes);
			} else {
				// 使用缺省显示动画
				noticeAnimation = AnimationUtils.loadAnimation(this,
						R.anim.activity_down);
			}
			noticeAnimation.setAnimationListener(noticeAreaAnimationListener);
			noticeLayout.startAnimation(noticeAnimation);
		}
	}

	/**
	 * 隐藏通知区域
	 * 
	 * @author Alonso Lee
	 */
	protected void dismissNotice() {

		if (noticeLayout != null) {
			isNoticeAreaShowing = false;

			if (mNoticeAreaDismissAnimationRes != -1) {
				// 设定自定义消失动画
				noticeAnimation = AnimationUtils.loadAnimation(this,
						mNoticeAreaDismissAnimationRes);
			} else {
				// 使用缺省显示动画
				noticeAnimation = AnimationUtils.loadAnimation(this,
						R.anim.activity_up);
			}
			noticeAnimation.setAnimationListener(noticeAreaAnimationListener);
			noticeLayout.startAnimation(noticeAnimation);
		}
	}

	/**
	 * 此handler用于控制定时关闭通知区域
	 */
	private Handler noticeAreaHandler = new Handler() {
		public void handleMessage(android.os.Message msg) {
			dismissNotice();
		};
	};

	/**
	 * 此方法用于测试当前界面是否需要接收xmpp事件回调
	 * 
	 * @return true 此界面需要接收xmpp事件回调; false 此界面不需要接收xmpp事件回调.
	 * @author Alonso Lee
	 */
	public boolean isCallbackEnable() {
		return this.callbackEnable;
	}

	/**
	 * 设定本界面需要接收xmpp事件回调
	 * 
	 * @author Alonso Lee
	 */
	protected void enableReceiveXmppEvent() {
		callbackEnable = true;
	}

	/**
	 * 设定本界面不需要接收xmpp事件回调
	 * 
	 * @author Alonso Lee
	 */
	protected void disableReceiveXmppEvent() {
		callbackEnable = false;
	}

	/**
	 * 此类封装状态栏上的通知区域的回调接口
	 * 
	 * @author Alonso Lee
	 * 
	 */
	protected interface NoticeAreaEventListener extends ViewEventListener {

	}

	private AnimationListener noticeAreaAnimationListener = new AnimationEndListener() {

		@Override
		public void onAnimationEnd(Animation animation) {
			if (isNoticeAreaShowing) {
				// 回调通知，已经正常显示了
				if (mNoticeAreaListener != null) {
					mNoticeAreaListener.onShow();
				}
				// 显示通知区域动画显示完毕，如果开启了定时自动关闭通知区域，那么延时通过handler实现
				if (isAutoDismissNoticeAreaEnable) {
					noticeAreaHandler.sendEmptyMessageDelayed(
							DISMISS_NOTICE_AREA, mNoticeAreaShowDuration);
				}

			} else {
				// 隐藏通知区域
				noticeLayout.setVisibility(View.GONE);
				// 回调通知，已经隐藏了
				if (mNoticeAreaListener != null) {
					mNoticeAreaListener.onDismiss();
				}
			}
		}
	};

	/********************************************************* 以下view控件点击事件处理 ***************************************************************************/

	/********************************************************* 以下为通知类view显示与消失的回掉处理 ***************************************************************************/

	private Handler mNoticeItemHandler = new Handler() {
		public void handleMessage(android.os.Message msg) {
			NoticeItem item = (NoticeItem) msg.obj;
			showNoticeItem(item);
		};
	};

	@Override
	public void onShow() {
		// TODO Auto-generated method stub
		onNoticeItemShow();
	}

	@Override
	public void onDismiss() {
		// TODO Auto-generated method stub
		onNoticeItemdDismiss();
	}

	@Override
	public void onTimeout() {
		// TODO Auto-generated method stub

	}

	protected void onNoticeItemShow() {

	}

	protected void onNoticeItemdDismiss() {
		LocalEnv.mNoticeItemManager.removeNoticeItem();
	}

	public void onNewNoticeItemAdded(NoticeItem item) {
		if (item == null) {
			Mylog.e("your param is null!");
			return;
		}

		android.os.Message msg = mNoticeItemHandler.obtainMessage();
		msg.what = 1;
		item.setContext(this);
		msg.obj = item;
		mNoticeItemHandler.sendMessageDelayed(msg, 500);
	}

	public void onNoticeItemRemoved(NoticeItem item) {
		// TODO Auto-generated method stub
		Mylog.d(item.getType() + " removed!");
	}

	public void onNoticeItemListEmpty() {
		// TODO Auto-generated method stub

	}

	private void showNoticeItem(NoticeItem item) {
		// if(!isActivityOn)
		// {
		// Mylog.e(TAG,"activity is off");
		// return;
		// }
		switch (item.getType()) {
		case TOAST:
			MyToast t = item.getToast();
			Mylog.d("要显示toast的界面是 " + activityName);
			MyToastUtil.showToastOnTop(t.getContext(), "你妹", 1000);
			// MyToastUtil.showToast(t);
			break;
		case DIALOG:
			break;
		case PROGRESSBAR:
			break;
		default:
			break;
		}
	}
	
	protected void setViewOnclickListener(int viewId, OnClickListener listener) {
		if (findViewById(viewId) != null) {
			findViewById(viewId).setOnClickListener(listener);
		}
	}

	protected void setViewOnclickListener(View viewId, OnClickListener listener) {
		if ((viewId) != null) {
			(viewId).setOnClickListener(listener);
		}
	}
	

	/**************************************************************************** 下面是处理网络连接建立和丢失的回调 ******************************************************************************************************/

	@Override
	public void onDataConnectionEstablished(ALConnectionType type) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onDataConnectionLost() {
		// TODO Auto-generated method stub

	}

	/********************************************************* 以下选择照片、拍照、截取照片的处理以及回调事件 ***************************************************************************/

	@Override
	protected void onActivityResult(int requestCode, int resultCode,
			Intent intent) {
		// TODO Auto-generated method stub
		super.onActivityResult(requestCode, resultCode, intent);
		if (resultCode != RESULT_OK) {
			return;
		}
		switch (requestCode) {
		case AndroidMultiMediaManager.ACTION_TAKE_PHOTOS:
			// 拍照返回
			processOnTakePhotosResult(intent);
			break;
		case AndroidMultiMediaManager.ACTION_SELECT_PHOTOS:
			// 选择照片
			processOnSelectPhotosResult(intent);
			break;
		case AndroidMultiMediaManager.ACTION_CROP_PHOTOS:
			// 裁剪图片
			processOnCropPhotosResult(intent);
			break;
		}
	}

	/**
	 * 处理拍照返回
	 * 
	 * @param result
	 */
	private void processOnTakePhotosResult(Intent result) {
		if (mPhotoProcessParam != null) {

			String imagePath = AndroidMultiMediaManager.getImagePath();
			if (TextUtils.isEmpty(imagePath)) {
				Mylog.e("拍照得到的图片路径有误");
				onGetProcessPhotosResult(imagePath, null);
				return;
			}

			if (mPhotoProcessParam.isCropRequested()) {
				Mylog.d("setting crop image request for image: " + imagePath);
				mPhotoProcessParam.setImagePath(imagePath);
				// 显示裁剪
				if (mPhotoProcessParam.isExplicitCrop()) {
					AndroidMultiMediaManager.dispatchCropPhotos(this,
							mPhotoProcessParam);
				} else {
					// 隐式裁剪
					String path = AndroidMultiMediaManager
							.cropPhotosInExplicitCrop(this, mPhotoProcessParam);
					String name = getFileName(path);

					// 回调通知图片处理完毕
					onGetProcessPhotosResult(path, name);
				}
			} else {
				String name = getFileName(imagePath);
				// 回调通知图片处理完毕
				onGetProcessPhotosResult(imagePath, name);
			}
		}
		// 重置图片处理参数
		reSetPhotoProcessParam();
	}

	/**
	 * 处理图片选择事件
	 * 
	 * @param result
	 */
	private void processOnSelectPhotosResult(Intent result) {

		Uri uri = result.getData();
		if (uri != null) {
			String filePath;
			if (ALFileManager.getFilePathByUri(uri) != null) {
				filePath = ALFileManager.getFilePathByUri(uri);
			} else {
				filePath = uri.getPath();
			}

			if (mPhotoProcessParam != null) {

				if (TextUtils.isEmpty(filePath)) {
					Mylog.e("选择得到的图片路径有误");
					onGetProcessPhotosResult(null, null);
					return;
				}

				if (mPhotoProcessParam.isCropRequested()) {
					Mylog.d("setting crop image request for image: " + filePath);
					mPhotoProcessParam.setImagePath(filePath);

					// 显示裁剪
					if (mPhotoProcessParam.isExplicitCrop()) {
						AndroidMultiMediaManager.dispatchCropPhotos(this,
								mPhotoProcessParam);
					} else {
						// 隐式裁剪
						String path = AndroidMultiMediaManager
								.cropPhotosInExplicitCrop(this,
										mPhotoProcessParam);
						String name = getFileName(path);

						onGetProcessPhotosResult(path, name);
					}

				} else {
					String name = getFileName(filePath);
					if (!TextUtils.isEmpty(mPhotoProcessParam.getSavePath())) {

						File src = new File(filePath);
						File dstDir = new File(mPhotoProcessParam.getSavePath());

						if (!dstDir.exists()) {
							dstDir.mkdirs();
						}
						File dst = new File(mPhotoProcessParam.getSavePath()
								+ name);

						try {
							ALFileManager.copyFile(src, dst);
						} catch (IOException e) {
							e.printStackTrace();
						}
					}
					filePath = mPhotoProcessParam.getSavePath() + name;

					onGetProcessPhotosResult(filePath, name);
				}
			}
		} else {
			onGetProcessPhotosResult(null, null);
		}

		reSetPhotoProcessParam();
	}

	/**
	 * 处理图片裁剪结果
	 * 
	 * @param result
	 */
	private void processOnCropPhotosResult(Intent result) {
		reSetPhotoProcessParam();

		String path = null;
		String name = null;

		if (result != null) {
			path = result.getAction();
			name = getFileName(path);
			Mylog.d("得到裁剪后的图片路径: " + path);
		}

		onGetProcessPhotosResult(path, name);
	}

	private String getFileName(final String filePath) {
		String name = null;

		if (!TextUtils.isEmpty(filePath)) {
			int lastSeparatorIndex = -1;
			lastSeparatorIndex = filePath.lastIndexOf(File.separator);

			if (lastSeparatorIndex != -1) {
				name = filePath.substring(lastSeparatorIndex + 1);
			}
		}

		return name;
	}

	/**
	 * 弹出拍照、选择图片对话框
	 * 
	 * @param param
	 */
	protected void showPhotoProcessDialog(ALImageProcessParams param) {
		mPhotoProcessParam = param;
		AndroidMultiMediaManager.showPhotoProcessDialog(this, false, param);
	}

	/**
	 * 打开照相机，执行拍照功能
	 * 
	 * @param param
	 */
	protected void takePhotos(ALImageProcessParams param) {
		mPhotoProcessParam = param;
		AndroidMultiMediaManager.dispatchTakePictureIntent(BaseActivity.this);
	}

	/**
	 * 跳转图库选择图片
	 * 
	 * @param param
	 */
	protected void selectPhotos(ALImageProcessParams param) {
		mPhotoProcessParam = param;
		AndroidMultiMediaManager.dispatchSelectPhotos(BaseActivity.this);
	}

	/**
	 * 打开裁剪图片界面
	 * 
	 * @param param
	 */
	protected void cropPhotos(ALImageProcessParams param) {
		mPhotoProcessParam = param;
		AndroidMultiMediaManager.dispatchCropPhotos(BaseActivity.this, param);
	}

	/**
	 * 重置图片处理配置参数
	 */
	protected void reSetPhotoProcessParam() {
		mPhotoProcessParam = null;
	}

	protected void onGetProcessPhotosResult(final String path, final String name) {

	}

	/********************************************************* 以下抽象函数为xmpp 事件回调，各界面根据相关需求重写相关函数 ***************************************************************************/

	public void handleConnectStateChangedEvent(XmppConnectionState newState,
			XmppConnectionState lastState) {
	}

	/**
	 * 登录成功后,此回调将被执行
	 * 
	 * @author Alonso Lee
	 */
	public void handleLoginedEvent() {
	}

	/**
	 * 当接收到登出成功后，此回调将被执行
	 * 
	 * @author Alonso Lee
	 */
	public void handleLogoutEvent() {
	}

	/**
	 * 当连接丢失时，此回调将被执行
	 * 
	 * @author Alonso Lee
	 */
	public void handleConnectionLostEvent(String errorMessage) {
	}

	/**
	 * 当账号验证失败时，此回调将被执行
	 * 
	 * @author Alonso Lee
	 */
	public void handleAuthFailedEvent(String errorMessage) {
	}

	/**
	 * 当账号冲突被踢下线时，此回调将被执行
	 * 
	 * @author Alonso Lee
	 */
	public void handlerOnConflictEvent() {
	}

	/**
	 * 当收到Message消息时，此回调将被执行
	 * 
	 * @author Alonso Lee
	 */
	public void handlerOnNewMessageArrivedEvent() {
	}

	/**
	 * 当收到Message消息回执时，此回调将被执行
	 * 
	 * @author Alonso Lee
	 */
	public void handlerOnMessageReceipt() {
	}

}
